$(function() {
	$('form[name="organization-form"]').submit(function() {
		var customSubmitRev = true;
		if (!customSubmitRev || !$(this).form('enableValidation').form('validate')) {
			return false;
		}
		$.ajax({
			type : 'POST',
			dataType : 'json',
			url : 'organization.do?saveOrUpdate',
			beforeSend : function() {
				$.messager.progress({
					text : '正在提交数据......',
					interval : 100
				});
			},
			data : $(this).serialize(),
			success : function(data) {
				$.messager.progress('close');
				var api = frameElement.api;
				opener = api.opener;
				if (data.status == '10000' || data.status == '10001'
						|| data.status == '10002'
						|| data.status == '10003'
						|| data.status == '10004'
						|| data.status == '10009') {
					opener.msgTip(data.message);
					api.close();
					opener.organizationListReloadGridTable();
				} else {
					opener.msgTip(data.message);
				}
			}
		});
		return false;
	});
	$('button[name="hideSubmitBtn"]').click(function() {
		$('form[name="organization-form"]').submit();
	});
});